package designpatterns.interpreter;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2/16/2022 7:32 PM
 */
public class AndExpression implements Expression {

    private Expression expression1 = null;
    private Expression expression2 = null;

    public AndExpression(Expression expression1, Expression expression2) {
        this.expression1 = expression1;
        this.expression2 = expression2;
    }

    @Override
    public boolean interpret(String context) {
        return expression1.interpret(context) && expression2.interpret(context);
    }
}
